namespace OpenWaves.ImageTransformations
{
    public class ScaleDownToFitTransformation : ScaleToFitTransformation
    {
        public ScaleDownToFitTransformation(int width, int height) : base(width, height)
        {
        }

        public ScaleDownToFitTransformation(string serializedProperties) : base(serializedProperties)
        {
        }

        public override void ApplyToImage(IImage image)
        {
            if (image.Width <= this.Width && image.Height <= this.Height)
                return;

            base.ApplyToImage(image);
        }

        protected override IImageTransformation Scale(int width, int height)
        {
            return new ScaleDownToFitTransformation(width, height);
        }
    }
}